package cn.bluedot.tea.util;

import java.text.SimpleDateFormat;

/**
 * 时间日期工具
 * @author Administrator
 *
 */
public class DateUtil {
	
   public static final String DATE_FORMAT = "yyyy-MM-dd";

   public static final String DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss";

   public static final String TIME_FORMAT = "HH:mm:ss";
   
   public static final String DATETIME_STR_FORMAT = "yyyyMMddHHmmss";
   
   public static SimpleDateFormat date_format = new SimpleDateFormat(DATE_FORMAT);
   public static SimpleDateFormat datetime_format = new SimpleDateFormat(DATETIME_FORMAT);
   public static SimpleDateFormat time_format = new SimpleDateFormat(TIME_FORMAT);
   public static SimpleDateFormat datetime_str_format = new SimpleDateFormat(DATETIME_STR_FORMAT);
	
   /**
    * 获得指定格式的时间字符串
    * @param pattern
    * @return
    */
   public static String format(String pattern) {
	   return new SimpleDateFormat(pattern).format(System.currentTimeMillis());
   }
   
   /**
    * yyyy-MM-dd
    * @return
    */
   public static String getDate() {
	   return date_format.format(System.currentTimeMillis());
   }
   /**
    * yyyy-MM-dd HH:mm:ss
    * @return
    */
   public static String getDateTime() {
	   return datetime_format.format(System.currentTimeMillis());
   }
   /**
    * HH:mm:ss
    * @return
    */
   public static String getTime() {
	   return time_format.format(System.currentTimeMillis());
   }
   /**
    * yyyyMMddHHmmss
    * @return
    */
   public static String getDateStrTime() {
	   return datetime_str_format.format(System.currentTimeMillis());
   }

}
